package com.tledu.mvc02.controller;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 测试使用注解开发controller层
 * @author Antg
 * @date 2021/8/11  11:54
 */
@Controller
@RequestMapping("/test01")//父接口
public class UserController1 {

    @RequestMapping("/add")//子接口
    public String add(){
        //如果返回值是字符串,那么对应的就是视图层的页面
        return "user/add";
    }
    @GetMapping("/get")
    @ResponseBody
    public String get(){
        return "这是一个get请求";
    }
    @PostMapping("/post")
    @ResponseBody
    public JSONObject post(){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("123","123");
        return jsonObject;
    }
    @DeleteMapping("/delete")
    @ResponseBody
    public String delete(){
        return "delete";
    }
    @PutMapping("put")
    @ResponseBody
    public String put(){
        return "put";
    }
}
